package com.mjk.manager.gen.impl.ui;

import com.mjk.common.base.model.BaseEntity;
import com.mjk.common.core.jdbc.util.TableUtils;
import com.mjk.common.util.StrUtils;
import com.mjk.manager.gen.IGen;
import com.mjk.manager.gen.dto.GenDto;

public interface IUiGen extends IGen {
	String SPACE = "\t";//一个空格键
	String TAB = "\t\t";//一个tab键
	String TAB_2 = "\t\t\t\t";
	String TAB_3 = "\t\t\t\t\t\t";
	String WRAP = "\r\n";//回车换行
	String RELACE_MATCH = "\\[.*?\\]";//去除的正则
	
	default boolean isVaild() {
		return true;
	}
	
	default String getTableName(GenDto model) {
		BaseEntity base = model.getEntity();
		String tableName = TableUtils.getTableName(base);
		if (tableName.contains("_")) {
			tableName = StrUtils.underlineToHump(tableName);
		}
		return tableName;
	}
	
	default String getTableName(BaseEntity model) {
		String tableName = TableUtils.getTableName(model);
		if (tableName.contains("_")) {
			tableName = StrUtils.underlineToHump(tableName);
		}
		return tableName;
	}
}
